package com.doctcloud.hisinfo.histable.domain.inpadm;

import com.baomidou.mybatisplus.annotation.TableName;
import com.doctcloud.common.core.annotation.Excel;
import com.doctcloud.common.core.annotation.TableDesc;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.io.Serializable;
import java.util.Date;

import static com.doctcloud.common.core.utils.StringUtils.trim;

/**
 * @ClassName 在院患者信息
 * @Author samula
 * @Descripe product by com.doctcloud
 * @Data 2025-09-23 3:05
 **/

@TableName("pats_in_hospital")
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(of = {"patientId", "visitId"})
@ToString
@TableDesc("在院患者")
public class PatsInHospitalDo implements Serializable {
    private static final long serialVersionUID = 1L;
    /** 患者ID */
    @Excel(name = "患者ID")
    @NotBlank(message = "患者ID不能为空")
    private String  patientId;
    /** 住院标识 */
    @Excel(name = "住院标识号")
    @NotNull(message = "患者住院标识不能为空")
    @Positive(message = "患者住院标识必须大于0")
    private Integer visitId;
    /** 护理单元代码 */
    @Excel(name = "护理单元代码")
    private String wardCode;
    @Excel(name = "科室代码")
    private String deptCode;
    @Excel(name = "床位")
    private String bedNo;
    @Excel(name = "入院日期时间")
    private Date admissionDateTime;
    @Excel(name = "入科日期时间")
    private Date admWardDateTime;
    @Excel(name = "主要诊断")
    private String diagnosis;
    @Data
    public static class primaryKey {
        private final String patientId;
        public primaryKey(String patientId) {
            this.patientId = patientId;
        }
    }

    public void setPatientId(String patientId) {
        this.patientId = trim(patientId);
    }

    public void setWardCode(String wardCode) {
        this.wardCode = trim(wardCode);
    }

    public void setDeptCode(String deptCode) {
        this.deptCode = trim(deptCode);
    }
}
